import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 定义路由规则
const routes=[
  {path:'/',redirect:'/films'},
  {path:'/city',component:()=>import('../views/city.vue')},
  {
    path:'/films',
    // 路由重定向
    redirect:'/films/in_theaters',
    component:()=>import('../views/Films/index.vue'),
    children:[
      { path:'/films/in_theaters',component:()=>import('../views/Films/nowPlaying.vue')},
      { path:'/films/coming_soon',component:()=>import('../views/Films/commingSoon.vue')},
    ]},
  {path:'/film',component:()=>import('../views/film.vue')},
  {path:'*',component:()=>import('../views/404.vue')}
]

const router = new VueRouter({
  /* mode: 'history',
  base: process.env.BASE_URL, */
  routes
})

export default router
